package com.easy;

/**
 * Created by Lxk on 2019/6/3.
 */
public class Solution876 {

    public ListNode middleNode(ListNode head) {
        if(head == null){
            return null;
        }
        int count = 0;
        ListNode cur = head;
        while(cur!=null){
            count++;
            cur = cur.next;
        }
        count = (count/2);
        cur = head;
        while(count!=0){
            cur = cur.next;
            count--;
        }
        return cur;
    }

}
